<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<#include "lib/lib.html" />
<title>菜单管理</title>
</head>
<body>
	<nav class="breadcrumb">
	 	 <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 菜单管理
		 <a  class="btn btn-success radius r mr-20" style="line-height: 1.6em; margin-top: 3px" href="javascript:location.replace(location.href);" title="刷新">
		 <i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="pd-20 text-c">
		<div class="text-c">
			<form action="${basePath}/function/gomenulist.do">
			<span class="select-box inline" >
			<select class="select" name="appId" id="appId" >
				<#if apps?? && apps?size gt 0 >
					<#list apps as al >
						<option value="${al.id!}">${al.appsName!}</option>
					</#list>
				</#if>
			</select>
			</span>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<button name="" id="" class="btn btn-success" type="submit"> <i class="Hui-iconfont">&#xe665;</i> 搜索 </button>
			</form>
		</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20">
			<span class="l">
				<a class="btn btn-primary radius" onclick="" href="javascript:menu_add();">
				<i class="Hui-iconfont">&#xe600;</i> 添加菜单</a></span> <span class="r"> 
			</span>
			
		</div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th width="25"><!-- <input type="checkbox" name="" value=""> --></th>
						<th width="150">菜单名称</th>
						<th width="150">菜单编码:</th>
						<th width="200">菜单响应路径</th>
						<th width="200">备注</th>
						<th width="150">创建时间</th>
						<th width="150">状态</th>
						<th width="150">导航排序</th>
						<th width="150">操作</th>
					</tr>
				</thead>
				<tbody>
					<#if funList.dataList?? && funList.dataList?size gt 0>
					<#list funList.dataList as dl >
						<tr class="text-c">
							<!-- <td><input type="checkbox" value="${dl.id}" name=""></td> -->
							<td>${dl_index+1}</td>
							<td>${dl.funName!}</td>
							<td>${dl.funCode!}</td>
							<td>${dl.funPath!}</td>
							<td>${dl.funRemark!}</td>
							
							<td>${dl.createTime?string('yyyy-MM-dd')}</td>
							<td>
								<#if dl.funStatus==0>
									<span class="label label-success radius">已启用</span>
								<#else>
									<span class="label radius">已停用</span>
								</#if>
							</td>
							<td>${dl.funSort!}</td>
							<td class="td-manage">
								<#if dl.funStatus==0>
								<a style="text-decoration:none" onClick="menu_stop(this,'${dl.id!}')" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe60e;</i></a> 
								<a title="编辑" href="javascript:;" onclick="menu_edit('菜单编辑','${basePath}/function/goaddmenu.do?id=${dl.id!}','1','800','500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
								<#else>
								<a style="text-decoration:none" onClick="menu_start(this,'${dl.id!}')" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe605;</i></a>
								</#if>
								<a title="删除" href="javascript:;" onclick="menu_del(this,${dl.id!})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
						</tr>
					</#list>
					</#if>
				</tbody>
			</table>
			
			</br>
			<div class="page_list"></div>
		</div>
	</div>
	<script type="text/javascript">
	
		$(function(){
		 	laypage({
		 	    cont: $('.page_list'), //容器。值支持id名、原生dom对象，jquery对象,
			    pages: ${funList.endPage! }, //总页数
		 	    //skip: true, //是否开启跳页
	// 	    	skin: 'molv',
		 	    groups: 10, //连续显示分页数
		 	    first: '首页', //若不显示，设置false即可
		 	    last: '尾页', //若不显示，设置false即可
		 	    curr:${funList.curPage!},
		 	   	hash: true, //开启hash
		 	    skin: '#00AA91',
		 	    jump: function(obj,first){ //触发分页后的回调
	// 	 	       $('.view').html('目前正在第'+ obj.curr +'页，一共有：'+ obj.pages +'页');
		 	    	if(!first){
		 	         	 window.location.href="${basePath}/function/gomenulist.do?curPage="+obj.curr +"&pageData="+10;
		 	    	}
		 	    }
		 	});
		 			
		});
	
		/*系统-菜单-添加*/
		function menu_add(title, url, w, h) {
			var appId = $("#appId").val();
			var url = '${basePath}/function/goaddmenu.do?appId=' + appId;
			layer_show('添加菜单', url, w, h);
		}
		
		/*系统-菜单-编辑*/
		function menu_edit(title, url, id, w, h) {
			layer_show(title, url, w, h);
		}
		
		/*系统-菜单-删除*/
		function menu_del(obj, id) {
			layer.confirm('确认要删除吗？', function(index) {
				var data = {};
				data.id = id;
				//后台请求保存数据
				$.axse("${basePath}/function/delmenu.do",  data, function(d){
					if(d.resultCode == 200){
						$(obj).parents("tr").remove();
						layer.msg('已删除!', {
							icon : 1,
							time : 1000
						});
					}else{
						Huimodal_alert("删除失败,请重试!",1500);
					}
				},
				function(d){
					Huimodal_alert("删除失败,请重试!",1500);
				});
			});
		}
		
		/*系统-菜单-停用*/
		function menu_stop(obj, id) {
			layer.confirm('确认要停用吗？', function(index) {
				var data = {};
				data.id = id;
				//后台请求保存数据
				$.axse("${basePath}/function/stopmenu.do",  data, function(d){
					if(d.resultCode == 200){
// 						$(obj).attr("title","启用");
// 						$(obj).child().find("i").html("&#xe615;");
						layer.msg('已删除!', {
							icon : 1,
							time : 1000
						});
						location.replace(location.href);
					}else{
						Huimodal_alert("删除失败,请重试!",1500);
					}
				},
				function(d){
					Huimodal_alert("删除失败,请重试!",1500);
				});
			});
		}
		
		/*系统-菜单-启用*/
		function menu_start(obj, id) {
			layer.confirm('确认要启用吗？', function(index) {
				var data = {};
				data.id = id;
				//后台请求保存数据
				$.axse("${basePath}/function/startmenu.do",  data, function(d){
					if(d.resultCode == 200){
// 						$(obj).attr("title","停用");
// 						$(obj).parent().find("i").html("&#xe631;");
						layer.msg('已删除!', {
							icon : 1,
							time : 1000
						});
						location.replace(location.href);
					}else{
						Huimodal_alert("删除失败,请重试!",1500);
					}
				},
				function(d){
					Huimodal_alert("删除失败,请重试!",1500);
				});
			});
		}
	</script>
</body>
</html>